// stores/dialogStore.js
import { defineStore } from 'pinia';

export const useDialogStore = defineStore('dialog', {
  state: () => ({
    isOpen: false,
    nodeType:'',
    position:{
        clientX:0,
        clientY:0
    },
    addNodeFlag:false
  }),
  actions: {
    open(position:any,nodeType:string) {
      this.isOpen = true;
      this.nodeType = nodeType;
      this.position = position;
    },
    close() {
      this.isOpen = false;
      this.addNodeFlag = false;
    },
    addNode(){
      this.addNodeFlag = true;
      this.isOpen = false;
    },
    setAddNodeFlag(flag:boolean){
        this.addNodeFlag = flag;
    }
  },
});